home *** CD-ROM | disk | FTP | other *** search
-
- #include <exec/exec.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include "XIM:doorheader.h"
- #include "XIM:glue.h"
-
- struct User {
- char Name[31],Pass[9],Location[30],PhoneNumber[13];
- USHORT Slot_Number;
- USHORT Sec_Status,
- Sec_Board, /* File or Byte Ratio */
- Sec_Library, /* Ratio */
- Sec_Bulletin, /* Computer Type */
- Messages_Posted;
- /* Note ConfYM = the last msg you actually read, ConfRead is the same ?? */
- ULONG NewSinceDate, ConfRead1, ConfRead2, ConfRead3, ConfRead4,
- ConfRead5;
- UWORD XferProtocol, Filler2;
- UWORD Lcfiles,BadFiles;
- ULONG AccountDate;
- UWORD ScreenType, Filler1;
- char Conference_Access[10];
- USHORT Uploads, Downloads, ConfRJoin, Times_Called;
- long Time_Last_On, Time_Used, Time_Limit, Time_Total;
- ULONG Bytes_Download, Bytes_Upload, Daily_Bytes_Limit, Daily_Bytes_Dld;
- char Expert;
- ULONG ConfYM1, ConfYM2, ConfYM3, ConfYM4, ConfYM5, ConfYM6, ConfYM7,
- ConfYM8, ConfYM9;
- long BeginLogCall;
- UBYTE Protocol, UUCPA, LineLength, New_User;
- };
- struct UserKeys { /* changes to UserKeys (RTS) */
- char UserName[31];
- long Number;
- UBYTE New_User;
- UWORD UPcps; /* highest upload cps rate */
- UWORD DNcps; /* highest dnload cps rate */
- UWORD Userflags; /* */
- UWORD baud_rate; /* last online baud rate */
- char Pad[9]; /* ?? should be 15 */
- };
-
- struct User U;
- struct UserKeys UK;
-
- void ShowIntro(void);
- char VaultCfg[200];
- char bbsroot[200];
- ULONG ShowValue(ULONG Value);
- FILE *CreateDataBase(char *s);
- void end(void);
- void LastCommand(void);
- char path[200];
- #define sm sendmessage
- #define gu getuserstring
- #define pm prompt
- #define hk hotkey
- #define pu putuserstring
- main(int argc,char *argv[])
- {
- FILE *fi,*fo;
- register int i;
- int num;
- ULONG Value;
- if(argc!=2)
- {
- printf("\n");
- printf("Bank version 1.0 , written by Joseph Hodge\n");
- printf("This is a product of the /X Developement Team - The Silent Achievers\n");
- printf("This is a (XIM) for AmiExpress 3.0+\n");
- printf("\n");
- exit(0);
- }
- Register(argv[1][0]-'0');
- strcpy(path,argv[0]);
- gu(bbsroot,DT_SLOTNUMBER);
- ShowIntro();
- i=strlen(path)-1;
- while(i)
- {
- if(path[i]==':' || path[i]=='/') {path[i+1]='\0'; break; }
- i--;
- }
- num=atoi(bbsroot);
- sprintf(VaultCfg,"%sBank.cfg",path);
- fi=fopen(VaultCfg,"r+b");
- if(fi==NULL) fi=CreateDataBase(VaultCfg);
- if(fi==NULL)
- {
- sm("",1);
- sm("Error creating Database",1);
- sm("",1);
- ShutDown();
- end();
- }
- if(!fseek(fi,(ULONG)sizeof(ULONG)*(ULONG)(num-1),0L))
- {
- fread((APTR)&Value,sizeof(ULONG),1,fi);
-
- }
- else
- {
- sm("",1);
- sm("Records indicate that you do not have an Account",1);
- sm("established with this BANK.",1);
- sm("",1);
- ShutDown();
- end();
- }
- fclose(fi);
- Value=ShowValue(Value);
- fi=fopen(VaultCfg,"r+b");
-
- if(!fseek(fi,(ULONG)sizeof(ULONG)*(ULONG)(num-1),0L))
- {
- fwrite((APTR)&Value,sizeof(ULONG),1,fi);
-
- }
- fclose(fi);
- ShutDown();
- end();
- }
- ULONG ShowValue(ULONG Value)
- {
- char image[100];
- ULONG Current=0L;
- ULONG Temp=0L;
- sm("",1);
- gu(image,DT_BYTESUPLOAD);
- Current=atol(image);
- sm("--------------------------------------",1);
- sm("Online | In The Bank ",1);
- sm("--------------------------------------",1);
- sprintf(image,"%-18ld| %-18ld",Current,Value);
- sm(image,1);
- sm("",1);
- pm("Enter Amount to transfer to current conference >: ",image,15);
- Temp=atol(image);
- if(Temp<=Value && Temp!=0L)
- {
- Current +=Temp;
- Value -=Temp;
- sprintf(image,"%ld",Current);
- pu(image,DT_BYTESUPLOAD);
- sm("Updating Account...",1);
- sm("",1);
- sm("--------------------------------------",1);
- sm("Online | In The Bank ",1);
- sm("--------------------------------------",1);
- sprintf(image,"%-18ld| %-18ld",Current,Value);
- sm(image,1);
- sm("",1);
-
- }
- return(Value);
- }
- FILE *CreateDataBase(char *s)
- {
- FILE *fi;
- ULONG Value;
- char image[200];
- int num=1;
- sm("",1);
- sm("Standby.. Creating Database..",1);
- sm("",1);
- fi=fopen(s,"wb");
- if(fi!=NULL)
- {
- while(Load_Account(num,(APTR)&U,(APTR)&UK))
- {
- Value=0L;
- if(U.Sec_Library==0)
- {
- Value=U.Bytes_Upload;
- }
- else
- {
- Value=U.Bytes_Upload-((ULONG)(U.Sec_Library)*U.Bytes_Download);
- }
- fwrite((APTR)&Value,sizeof(ULONG),1,fi);
- num++;
- }
- fclose(fi);
- fi=fopen(s,"r+b"); return(fi);
- }
- return(fi);
- }
-
- void ShowIntro(void)
- {
- sm("",1);
- sm(" .------------------------------------------------------------------------.",1);
- sm(" | Ami-Express GLOBAL Version 1.0 Written by ByteMaster |",1);
- sm(" | /X Development Team - The Silent Achievers |",1);
- sm(" `------------------------------------------------------------------------'",1);
- sm("",1);
- }
-
- void LastCommand(void)
- {
- sm("",1);
- sm("",1);
- }
- void end(void)
- {
- exit(0);
- }